package May;

import java.util.Scanner;

public class DAY0529 {
    //字符串反转
    public static void main1(String[] args) {
        //接收数据
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        String r = " ";
        int length = s.length();
        for (int i = 0; i < length; i++) {
            r = s.charAt(i)+r;
        }
        System.out.println(r);
    }
    //公共子串计算
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String a = scanner.nextLine();
        String b = scanner.nextLine();

        int n = 0;

        //比较长度交换顺序
        if (a.length()<=b.length()){
            n = common(b,a);
        }else {
            n = common(a,b);
        }
        System.out.println(n);
    }
    public static int common(String a,String b){
        String result = "";
        for (int i = 1; i < a.length(); i++) {
            StringBuilder sb = new StringBuilder();
            for (int j = i - 1; j < a.length(); j++) {
                if (b.contains(sb.append(a.charAt(j)))) {
                    if (sb.length() > result.length()) {
                        result = sb.toString();
                    }
                }
            }
        }
        return result.length();
    }
}
